function bmicalc(unitchoice,height,weight){

	var bmi=0;
	
//convert to SI	
if (!unitchoice){
weight=weight*0.45359237;
//weight=Math.round(weight);
height=height/0.393700787402;
}

	
//If SI bmi = weight(kg)/height(m)^2
//if (unitchoice){
//height from cm to m
height=height/100;
bmi=weight/Math.pow(height,2);
//}


//If Imp wt(lbs)/height(ins)^2  x 703

//if (!unitchoice){
//bmi=weight/Math.pow(height,2);
//bmi=bmi*703;
//}

//round off 2 dec places
bmi=Math.round(bmi*100)/100;

//convert back to SI
//if (!unitchoice){
//weight=weight*0.454;
weight=Math.round(weight);
//height=height*0.025;
//}

height=height*100;
height=Math.round(height);

return {
			 bmi:bmi,
			 height:height,
			 weight:weight
		};		 
}



function ref(){
// display reference
 return "Calle EE. NEJM 1999;341:1097-1105" +"<br />Adult values:" + "<br />< 18.5 = Underweight" + "<br />18.5-24.9 = Normal"+ "<br />25-29.9 = Overweight"+ "<br />>30 = Obese";

}